package com.molin.StreamTest;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Stream;

public class Demo5 {
    public static void main(String[] args) {
        ArrayList<String> nameList = new ArrayList<>(List.of("张三丰", "张无忌", "谢敏", "张良", "王二麻子", "张隆基"));
//        method1(nameList);
        long num=nameList.stream().count();
        System.out.println(num);
    }

    public static void method1(ArrayList<String> nameList) {
        nameList.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });
        nameList.stream().forEach(s-> System.out.println(s));
    }

}
